#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <string.h>

int main()
{
    char ch[1001];
    scanf("%s", ch);

    int len = strlen(ch);
    int count = 1;
    int max_count = 1;
    char max_letter = ch[0];
    for (int i = 0; i < len - 1; i++)
    {
        if (ch[i] == ch[i + 1])
        {
            count++;
            max_letter = count > max_count ? ch[i] : max_letter;
            max_count = count > max_count ? count : max_count;
        }
        else
            count = 1;
    }
    printf("%d\n%c", max_count, max_letter);
    return 0;
}